const http = require('http')

// http.get({
//   host:'localhost',
//   port:1234,
//   path:'/?a=1'
// }, (res)=>{

// })

let options = {
  host:'localhost',
  port:1234,
  path:'/?a=1',
  method:'POST',
  headers:{
    // "Content-type":"application/json"
    "Content-type":"application/x-www-form-urlencoded"
  }
}
// 返回对象为一个可写流
let req = http.request(options, (res)=>{
  let arr = []
  res.on('data',(data)=>{
    arr.push(data)
  })
  res.on('end', ()=>{
    let obj = Buffer.concat(arr).toString()
    console.log('处理后的数据接收',obj)
  })
})
// req.end('世界和平')
// req.end('{"name":"cjh"}')
req.end('a=1&b=2')
